package com.hackintosh.metal;

import java.util.ArrayList;
import java.util.List;

/**
 * @description：被访问元素的集合 容器
 * @author：twislyn
 * @date：Created in 2021/06/06
 * @modified By：
 * @version: 1.0
 */
public class MaterialContainer {
    private List<Material> materialList = new ArrayList<>();

    public void add(Material material) {
        materialList.add(material);
    }

    public void remove(Material material) {
        materialList.remove(material);
    }

    public void useMaterial(Company company) {
        for (Material material : materialList) {
            String result = material.accept(company);
            System.out.println(result);
        }
    }
}
